package com.training.project.service;

import java.util.ArrayList;
import java.util.List;

import com.training.project.entity.Pet;
import com.training.project.ui.Menu;
import com.training.project.util.XmlHelper;

public class PetShop {
	private List<Pet> list;
	
	public void run() {
		
		list = XmlHelper.readFromXml();
		
		boolean f = true;
		
		while (f) {
			String opt = Menu.optMenu();
			switch (opt) {
			case "1":
				Pet pet = Menu.addPetMenu();
				list.add(pet);
				XmlHelper.saveToXml(pet);
				break;
			case "2":
				System.out.println(list);
				break;
			case "0":
				f = false;
				System.out.println("谢谢使用^_^");
				break;
			default:
				break;
			}
		}
	}
	public static void main(String[] args) {
		new PetShop().run();
	}

}
